package cn.hadron.aa.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import cn.hadron.aa.dao.BaseDao;
import cn.hadron.aa.service.BaseService;
import cn.hadron.aa.util.Pager;

public class BaseServiceImpl<T> implements BaseService<T>{
    //Spring4增强@Autowired，根据泛型自动装配
	@Autowired
	protected BaseDao<T> dao;
  
	@Override
    public void add(T entity) {  
        dao.save(entity);  
    }  
    @Override
    public void modify(T entity) {  
        dao.update(entity);  
    }  
    @Override
    public void delete(T entity) {  
        dao.delete(entity);  
    }  
    @Override
    public void delete(Integer id) {  
        dao.delete(get(id));  
    }
    @Override
    public T get(Integer id){
    	return dao.get(id);
    }
    @Override
    public Pager<T> getPager(Integer pageNo, Integer pageSize){
    	return dao.getPager(pageNo, pageSize);
    }

}